package com.zwr.sheller.customer.Service.Impl;

import com.zwr.sheller.core.pojo.Goods;
import com.zwr.sheller.core.pojo.User;
import com.zwr.sheller.customer.Service.ConcernsService;
import com.zwr.sheller.customer.mapper.ConcernsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 *
 *@author Kang
 *@date
 */
@Service("concernService")
public class ConcernsServiceImpl implements ConcernsService {

    @Autowired(required = false)
    ConcernsMapper concernsMapper;

    @Override
    public Goods findGoods(Long id) {

        Goods goods = concernsMapper.findGoods(id);
        return goods;
    }

    @Override
    public void receiveCoupons(Long userId, Long couponsId) {
        concernsMapper.receiveCoupons(userId,couponsId);
    }

    @Override
    public List<Map<String, Object>> selectByCoupons(Long userId) {
        List<Map<String, Object>> mapList = concernsMapper.selectByCoupons(userId);

        return mapList;
    }

    @Override
    public List<Map<String, Object>> selectByCouponsTime(Long userId) {
        List<Map<String, Object>> mapList = concernsMapper.selectByCouponsTime(userId);
        return mapList;
    }

    @Override
    public List<Map<String, Object>> selectByCouponsUsed(Long userId) {
        List<Map<String, Object>> mapList = concernsMapper.selectByCouponsUsed(userId);
        return mapList;
    }

    @Override
    public List<Map<String, Object>> selectByNotCouponsUsed(Long userId) {
        List<Map<String, Object>> mapList = concernsMapper.selectByNotCouponsUsed(userId);
        return mapList;
    }

    @Override
    public User selectInformation(Long userId) {
        User user = concernsMapper.selectInformation(userId);
        return user;
    }

    @Override
    public void updatePhone(Long userId, String phone) {
        concernsMapper.updatePhone(userId,phone);
    }

    @Override
    public void updatePassword(Long userId, String pwd) {
        concernsMapper.updatePassword(userId,pwd);
    }

    @Override
    public void updateInformation(Long userId,String userPhone,String userName,String userRetailName,String userPrinciple,String userHead) {
        concernsMapper.updateInformation(userId,userPhone,userName,userRetailName,userPrinciple,userHead);
    }


}
